<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd 

">
<html>
<head>
 <base href="<%=basePath%>">   
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>快速注册</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1.0"/>
    <meta name="format-detection" content="telephone=no, email=no"/>
    <link rel="stylesheet" href="css/common.css"/>
    <link rel="stylesheet" type="text/css" href="css/index.css"/>
    <link rel="stylesheet" type="text/css" href="lib/css/layer.css"/>
    <script src="lib/js/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
    <script charset="utf-8" src="<%=basePath%>kindeditor/kindeditor-all.js"></script>
<script charset="utf-8" src="<%=basePath%>kindeditor/lang/zh_CN.js"></script>
<link rel="stylesheet" href="<%=basePath%>kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="<%=basePath%>kindeditor/plugins/code/prettify.css" />
<script charset="utf-8" src="<%=basePath%>kindeditor/plugins/code/prettify.js"></script>
    <script type="text/javascript">
	var editor1;
	KindEditor.ready(function(K) {
		editor1 = K.create('textarea[name="content1"]', {
			cssPath : "kindeditor/plugins/code/prettify.css",
			uploadJson : 'kindeditor/jsp/upload_json.jsp',
			fileManagerJson : 'kindeditor/jsp/file_manager_json.jsp',
			allowFileManager : true,
			width:"90%",
			 afterCreate : function() {
				this.loadPlugin('autoheight');
			}, 
			 
			items : [ 'fullscreen', 'source', 'table', 'insertfile', 'link',
					'image', 'emoticons', '|', 'forecolor', 'hilitecolor',
					'bold', 'underline', 'removeformat', '|', 'justifyleft',
					'justifycenter', 'justifyright', 'preview' ]
			
		});
 
	});
</script>
<script type="text/javascript">
 
function fun2(){
	
	var oneuser={UserID:"",Password:"",Password2:"",NickName:"",UserCode:"",BankAddress:"",BankCard:"",BankName:"",img:"",anzhiName:""};
	oneuser.UserID=$("#UserID").val();
	oneuser.Password=$("#Password").val();
	oneuser.Password2=$("#Password2").val();
	oneuser.NickName=$("#NickName").val();
	oneuser.UserCode=$("#UserCode").val();
	oneuser.BankAddress=$("#BankAddress").val();
	oneuser.BankCard=$("#BankCard").val();
	oneuser.BankName=$("#BankName").val();
	oneuser.img=editor1.html();
	oneuser.anzhiName=$("#anzhiName").val();
	for(var i in oneuser){
		if(oneuser[i]==""){
			alert("以上信息不能存在空值");
			return
		}
	}
	if(oneuser.Password!=oneuser.Password2){
		alert("两次输入的密码不一致");
		return ;
	}
 
	var ou = oneuser;
	$.ajax({
		type : 'post',
		url : '${pageContext.request.contextPath}/addUsers.html',
		data : ou,
		success : function(data) {
			if(data=="noid"){
				alert("你的推荐人不存在，请核对后再提交");
			}
			else if(data=="pp"){
				alert("你的注册申请已经提交，无需再次提交");
			}
			else{
				alert("您的注册申请已提交，请等待审核")
				window.close();
			}
		}
	});
}

window.onload=function(){
}
</script>
</head>
<body>
<body class="">
<div class="login_bg">
    <img src="img/login_bg.png">
    <div>
        <div class="register_title" style="display:none;">
            <a href="javascript:location.href='applogin.html'">
                <i class="icon"></i>
            </a>
            <a class="login_btn" href="applogin.html">登录</a>
        </div>
        <div class="register_content">
            <div class="register_part2">
                <div class="item">
                    <input type="text" id=UserID placeholder="用户名" oninput="if(value.length>11)value=value.slice(0,11)"
                           onkeyup="value = value.replace(/[^\d{2}\.]/g, '').replace(/(\.\d{2}).*/g, '$1')"/>
                </div>
               
                    <div class="item">
                    <input type="password" id="Password" placeholder="密码" oninput="if(value.length>11)value=value.slice(0,11)"
                           onkeyup="value = value.replace(/[^\d{2}\.]/g, '').replace(/(\.\d{2}).*/g, '$1')"/>
                </div>
                    <div class="item">
                    <input type="password" id="Password2" placeholder="确认密码" oninput="if(value.length>11)value=value.slice(0,11)"
                           onkeyup="value = value.replace(/[^\d{2}\.]/g, '').replace(/(\.\d{2}).*/g, '$1')"/>
                </div>  <div class="item">
                    <input type="text" id="NickName" placeholder="姓 名" oninput="if(value.length>11)value=value.slice(0,11)"
                           onkeyup="value = value.replace(/[^\d{2}\.]/g, '').replace(/(\.\d{2}).*/g, '$1')"/>
                </div> <div class="item">
                    <input type="text" id="UserCode" placeholder="身 份 证 号" oninput="if(value.length>11)value=value.slice(0,11)"
                           onkeyup="value = value.replace(/[^\d{2}\.]/g, '').replace(/(\.\d{2}).*/g, '$1')"/>
                </div><div class="item">
                    <input type="text" id="BankAddress" placeholder="地址" oninput="if(value.length>11)value=value.slice(0,11)"
                           onkeyup="value = value.replace(/[^\d{2}\.]/g, '').replace(/(\.\d{2}).*/g, '$1')"/>
                </div>
                <div class="item">
                    <input type="text" id="BankCard" placeholder="卡号" oninput="if(value.length>11)value=value.slice(0,11)"
                           onkeyup="value = value.replace(/[^\d{2}\.]/g, '').replace(/(\.\d{2}).*/g, '$1')"/>
                </div>   <div class="item">
                    <input type="text" id="BankName" placeholder="开 户 行" oninput="if(value.length>11)value=value.slice(0,11)"
                           onkeyup="value = value.replace(/[^\d{2}\.]/g, '').replace(/(\.\d{2}).*/g, '$1')"/>
                </div> <div class="item">
                    <li><textarea id="img" placeholder="身份证照片(正反面)" name="content1"  rows="4"></textarea></li>
                </div><div class="item">
                    <input type="text" id="anzhiName" placeholder="推荐人" oninput="if(value.length>11)value=value.slice(0,11)"
                           onkeyup="value = value.replace(/[^\d{2}\.]/g, '').replace(/(\.\d{2}).*/g, '$1')"/>
                </div>
                <input type="button" class="register_btn disabled" style="text-align: center"
                   id="register_btn" value="保存" onclick="fun2()">
                <!--<input type="button" class="register_btn disabled" disabled id="register_btn" value="立即注册">-->

              
            </div>
          
        </div>
    </div>
    <div class="modal" id="modal"  style="display: none;">
        <img src="img/loading.svg" class="loadingImg" >
    </div>
</div>

</body>
<script src="lib/js/layer.js" type="text/javascript" charset="utf-8"></script>
<!--头部-->
<script src="lib/js/RainbowBridge.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    setTitle(".register_title", {'title': '快速注册'});
    function recommendFn(val) {
        if (val.length) {
            $.ajax({
                type: "GET",
                url: getAPIURL() + "Register/checkPromotion",
                dataType: "json",
                contentType: "application/json",
                data:{
                    account:val
                },
                success:function (data) {
                    if(data.rtn==1){
                        if(data.Message!=""&&data.Message!=null){
                            $("#recommendName").html(": &nbsp;&nbsp;"+data.Message)
                        }
                    }
                    else if(data.rtn==-1){
                        $("#recommendName").html("")
                    }
                }
            })
        }
    }
</script>
<script src="js/reg.js?v=1.2.2" type="text/javascript" charset="utf-8"></script>
</html>
